<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery\jquery.js"></script>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        #bg{
            width: 200px;
            background-color: darkgrey;
            border: top 10px solid darkgrey;
            border-left: 5px solid darkgrey;
            border-right: 5px solid darkgrey;
            border-bottom: 10px solid darkgrey;
            margin: 50px auto;
        }
        #content{
            list-style: none;

        }
        .title{
            /* padding: 0;
            margin: 0; */
            font: size 15px;
            height: 40px;
            width: 200px;
            background:#07f;
            color:#fff;
            line-height: 40px;
            text-align: center;
            cursor: pointer;
            border-bottom: 1px solid #ccc;

        }
        .child{
            margin: 0px auto;
            width:170px；
            list-style: none;
        }
        .child li{
            height: 30px;
            line-height: 30px;
            background:#eee;
            border-bottom: 1px solid #ccc;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <style>
         $(function(){
            $(".child").slideDown(100);
            /* $(".child").hide(); */
            /* 隐藏所有子菜单 */
            $(".title:first").addClass("current");
            /* $(".child").eq(0).animate({"height":"200px"},300) */
            $(".child").eq(0).show(100);

            $(".title").chick(function(){
                $(".title").removeClass("current");
                $(this).addClass("current");
                $(".child").animate({"height":"0px"},300);


            });

        }); 

        
    </style>
    <div id="bg">
        <ul id="content">
            <li>
                <h3 class="title">项目1</h3>
                <ul class="child">
                    <li>子项目1</li>
                    <li>子项目1</li>
                    <li>子项目1</li>
                    <li>子项目1</li>
                </ul>
            </li>
            <li>
                <h3 class="title">项目2</h3>
                <ul class="child">
                    <li>子项目1</li>
                    <li>子项目1</li>
                    <li>子项目1</li>
                    <li>子项目1</li>
                </ul>
            </li>
            <li>
                <h3 class="title">项目3</h3>
                <ul class="child">
                    <li>子项目1</li>
                    <li>子项目1</li>
                    <li>子项目1</li>
                    <li>子项目1</li>
                </ul>
            </li>
        </ul>
    </div>
</body>
</html>